package run.bottle.app.model.support;

import io.netty.channel.Channel;
import io.netty.channel.group.ChannelGroup;
import io.netty.channel.group.DefaultChannelGroup;
import io.netty.util.concurrent.GlobalEventExecutor;
import run.bottle.app.model.dto.UserDTO;

import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author: Lycheng
 * @date: 2020/10/28 21:53
 */
public class BottleConst {

    /* 所有连接/通道 */
    public static final ChannelGroup CHANNELS = new DefaultChannelGroup(GlobalEventExecutor.INSTANCE);

    /* 所有在线用户
     *  k -> User Id
     *  v -> User Entity
     * */
    public static final Map<String, UserDTO> USER = new ConcurrentHashMap<>(50);

    /* 用户与通道
     *  k -> User Id
     *  v -> User Channel
     * */
    public static final Map<String, Channel> USERS_CHANNER = new ConcurrentHashMap<>(50);

    /* 群组与用户
    *  k -> Group Id
    *  v -> User Ids
    * */
    public static final Map<String, List<Channel>> GROUP_CHANNER = new ConcurrentHashMap<>(20);

    public static final Map<String, Channel> GUEST = new ConcurrentHashMap<>(20);

}
